package com.dzjcloud.dzj.question.biz.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.lang.Validator;
import com.dzjcloud.dzj.common.core.constant.CommonConstants;
import com.dzjcloud.dzj.common.core.utils.R;
import com.dzjcloud.dzj.common.redis.utils.RedisUtil;
import com.dzjcloud.dzj.upms.api.feign.TestFeginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <h3>dzj-cloud</h3>
 * <p>测试控制器</p>
 *
 * @author : DongZeJian
 * @date : 2021-04-30 15:21
 **/
@RestController
@Slf4j
@RequestMapping("/test")
public class TestController {



    @Resource
    private TestFeginService testFeginService;

    @Autowired
    private RedisUtil redisUtil;

    @GetMapping
    @SaIgnore
    public R<String> test(){
        R<String> test = testFeginService.test();
        Validator.validateEqual(test.getCode(), CommonConstants.SUCCESS,"调用基础异常异常："+test.getMsg());
        return test;
    }

    @GetMapping("/1")
    public void test1(){
        redisUtil.set("1","1",10);
    }
}
